"""
__author__ = 'heyanmin'
__time__ = '2021/5/23 9:16 下午'
"""
# 启动mitm
# Basic skeleton of a mitmproxy addon.
# Run as follows: mitmproxy -s anatomy.py

from mitmproxy import ctx


class Counter:
    def __init__(self):
        self.num = 0

    def request(self, flow):
        self.num = self.num + 1
        ctx.log.info("We've seen %d flows" % self.num)


class HY:
    def __init__(self):
        self.num = 0

    def request(self, flow):
        self.num = self.num + 1
        ctx.log.info("验证addons插件")

# 1.addons插件，mitmproxy启动时会查找是否有addons变量，如果有，遍历addons中的对象
# 2.[obj]，列表中包含实例对象，是实例，不是类；；addons中可以加多个实例
addons = [
    HY()
]